package com.zhkj.txg.module.cart.model

import com.zhkj.lib.http.BaseApiService
import com.zhkj.lib.http.BaseResponse
import com.zhkj.txg.module.cart.entity.CartNumberChangeResponse
import com.zhkj.txg.module.cart.entity.CartResponse
import com.zhkj.txg.module.home.entity.HotGoodsResponse
import io.reactivex.Observable
import retrofit2.http.*

interface CartApi : BaseApiService {
    @GET("api/cart/index")
    fun getCart(@Query("token") token: String): Observable<CartResponse>

    @GET("api/cart/index")
    fun getCartNew(@QueryMap map: Map<String, String>): Observable<CartResponse>

    @FormUrlEncoded
    @POST("api/cart/changeNum")
    fun changeCartNumber(
        @FieldMap map: Map<String, String>
    ): Observable<CartNumberChangeResponse>

    @GET("api/index/hotGoods")
    fun hotGoods(
        @Query("token") token: String,
        @Query("page") page: Int,
        @Query("rows") numb: Int
    ): Observable<HotGoodsResponse>

    @FormUrlEncoded
    @POST("api/cart/delete")
    fun deleteCart(
        @Field("token") token: String,
        @Field("cart_ids") CartIds: String
    ): Observable<BaseResponse>

    @FormUrlEncoded
    @POST("api/cart/delete")
    fun deleteCart(
        @Field("token") token: String,
        @Field("cart_ids[]") CartIds: MutableList<String>
    ): Observable<BaseResponse>
}